<template>
  <split-panel v-if="departmentid??false">
    <template v-slot:left-content>
      <terminal-tree v-model:departmentid="departmentid"/>
    </template>
    <template v-slot:right-content>
      <terminal-list :departmentid="departmentid" />
    </template>
  </split-panel>
</template>

<script lang="ts">
import {defineComponent, ref} from 'vue'
import SplitPanel from '@/components/split-panel/index.vue'
import TerminalTree from "@/views/terminal/components/department-tree.vue"
import TerminalList from "@/views/terminal/components/table-list.vue"
import {deptSelectbyName} from "@/api/dept"

export default defineComponent({
  name: 'terminal',
  components: {TerminalTree, SplitPanel, TerminalList},
  setup() {
    const departmentid = ref('') // 部门ID

    ~async function () {
      const data = await deptSelectbyName({name: 'root'})
      departmentid.value = data.departmentid
    }()

    return {
      departmentid
    }
  },
})

</script>

<style scoped>

</style>
